package com.aisile.ssq.controller;


import com.aisile.model.base.vos.R;
import com.aisile.ssq.service.SsqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:yry
 * @Date:2024/6/20 0020
 * @VERSON:1.0
 */
@RestController
@RequestMapping("/ssq")
public class SsqController {

    @Autowired
    private SsqService ssqService;


    /**
     * 异步树查询方式
     * @param id 前端获取的数据id  是查询的pid
     * @return
     */
    @GetMapping("/list/{id}")
    public R findSsqListByPid(@PathVariable("id") Integer id){
        return ssqService.findSsqByParentId(id);
    }

    /**
     * 同步递归查询
     * @return
     */
    @GetMapping("/list/ssq_dg")
    public R findSsqByDg(){
        // 从0 开始
       return R.ok( ssqService.dg(0));
    }

    /**
     * 查询全部数据
     * @return
     */
    @GetMapping("/list")
    public R findAll(){
        return R.ok(ssqService.list());
    }


}
